load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "indexadvisor",
    srcs = [
        "algorithm.go",
        "indexadvisor.go",
        "model.go",
        "optimizer.go",
        "options.go",
        "utils.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/planner/indexadvisor",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/domain",
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/meta/metadef",
        "//pkg/meta/model",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/parser/opcode",
        "//pkg/planner/util/fixcontrol",
        "//pkg/sessionctx",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util/chunk",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/parser",
        "//pkg/util/set",
        "//pkg/util/sqlexec",
        "@com_github_google_uuid//:uuid",
        "@com_github_pkg_errors//:errors",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "indexadvisor_test",
    timeout = "short",
    srcs = [
        "indexadvisor_sql_test.go",
        "indexadvisor_test.go",
        "indexadvisor_tpch_test.go",
        "optimizer_test.go",
        "options_test.go",
        "utils_test.go",
    ],
    flaky = True,
    shard_count = 48,
    deps = [
        ":indexadvisor",
        "//pkg/parser/mysql",
        "//pkg/testkit",
        "//pkg/util/set",
        "@com_github_stretchr_testify//require",
    ],
)
